home *** CD-ROM | disk | FTP | other *** search
/ PC Media 23 / PC MEDIA CD23.iso / share / prog / pcl4w12 / pcl4wusr.doc < prev    next >
Text File  |  1995-08-07  |  74KB  |  2,109 lines

  1.  
  2.  
  3.                   Personal Communications Library
  4.  
  5.                            For Windows
  6.  
  7.  
  8.                              (PCL4W)
  9.  
  10.  
  11.  
  12.                           USERS MANUAL
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                            Version 1.2
  19.  
  20.                           August 8, 1995
  21.  
  22.  
  23.  
  24.  
  25.                  This software is provided as-is.
  26.           There are no warranties, expressed or implied.
  27.  
  28.  
  29.  
  30.  
  31.                        Copyright (C) 1995
  32.                        All rights reserved
  33.  
  34.  
  35.  
  36.                    MarshallSoft Computing, Inc.
  37.                        Post Office Box 4543
  38.                        Huntsville AL 35815
  39.  
  40.                        Voice  205-881-4630
  41.                        FAX    205-880-0925
  42.                        BBS    205-880-9748
  43.                      email  msc@traveller.com
  44.  
  45.                            _______
  46.                       ____|__     |                (R)
  47.                    --+       |    +-------------------
  48.                      |   ____|__  |  Association of
  49.                      |  |       |_|  Shareware
  50.                      |__|   o   |    Professionals
  51.                    --+--+   |   +---------------------
  52.                         |___|___|    MEMBER
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  PCL4W Users Manual                                                Page 1
  69.                        C O N T E N T S
  70.  
  71.  
  72.  
  73.  
  74.  
  75.   Chapter                                                   Page
  76.  
  77.   1.0 Introduction................................................3
  78.       1.1 User Support............................................4
  79.       1.2 ASP Ombudsman...........................................4
  80.       1.3 A Typical Application...................................5
  81.       1.4 Installation............................................6
  82.   2.0 Library Organization........................................7
  83.       2.1 Configuration...........................................7
  84.       2.2 Initialization & Termination............................7
  85.       2.3 Modem Control & Status..................................8
  86.       2.4 Serial I/O..............................................8
  87.       2.5 Error Detection.........................................9
  88.       2.6 General Support.........................................9
  89.   3.0 Library Overview...........................................10
  90.       3.1 Dynamic Link Libraries.................................10
  91.       3.2 DOS Protected Mode Interface...........................10
  92.       3.3 Memory Models..........................................10
  93.       3.4 Using the Library......................................10
  94.       3.5 Example Programs.......................................11
  95.       3.6 Making the Library.....................................11
  96.   4.0 Talking to Your Modem......................................12
  97.       4.1 Modem Standards........................................12
  98.       4.2 Flow Control...........................................13
  99.       4.3 MODEM_IO Functions.....................................13
  100.       4.4 Modem Initialization...................................14
  101.   5.0 Problems...................................................15
  102.   6.0 Serial Communications......................................16
  103.       6.1 Communications Basics..................................16
  104.       6.2 Standard Port Addresses................................17
  105.       6.3 Running 3 or 4 Ports Concurrently......................18
  106.       6.4 Using Multiport Boards.................................19
  107.           6.4.1 Using the Digiboard..............................19
  108.           6.4.2 Using the BOCA board.............................19
  109.       6.5 Transmitter Interrupts.................................20
  110.       6.6 RS232 Signals..........................................21
  111.       6.7 National INS8250, INS16450, and INS16550 UARTs.........22    6.7 National INS8250, INS16450, and INS16550 UARTs.........22
  112.       6.8 Register Summary.......................................23
  113.   7.0 Example Programs...........................................25
  114.       7.1 SIMPLE.C...............................................25
  115.       7.2 TERM.C.................................................26
  116.   8.0 Legal Issues...............................................27
  117.       8.1 Registration...........................................27
  118.       8.2 License................................................28
  119.       8.3 Warranty...............................................28
  120.   9.0 Summary....................................................29
  121.       9.1 Revision History.......................................29
  122.       9.2 Function Summary.......................................30
  123.       9.3 Further Reading........................................31
  124.  10.0 Other MarshallSoft Computing products for C................31
  125.      10.1 The Personal Communications Library for C..............31
  126.      10.2 Libraries for Other Languages..........................31
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  PCL4W Users Manual                                                Page 2
  137.   1.0 Introduction
  138.  
  139.  
  140.   The  Personal  Communications Library for Windows (PCL4W) is an asynchronous
  141.   communications dynamic link library (DLL) for software developers using  the
  142.   Microsoft  Windows  7.0  (or  higher)  compiler and the Windows 3.1 Software
  143.   Development Kit (SDK) or the Borland 3.1  (or  higher)  windows  development
  144.   environment.  A 80386 machine or higher is recommended.
  145.  
  146.  
  147.   o 30+ communications functions.
  148.   o Supports the high performance INS16550 UART.
  149.   o Supports the PC/4 and PC/8 DigiBoard.
  150.   o Supports the BOCA BB1004, BB1008, and BB2016 boards.
  151.   o Supports hardware (RTS/CTS) flow control.
  152.   o Use any IRQ (IRQ0-IRQ15) with any UART address.
  153.   o Interrupt driven receiver & (optionally) transmitter.
  154.   o Supports 300 baud to 115,200 baud.
  155.   o Supports COM1 through COM20.
  156.   o Adjustable queues from 8 bytes to 32 KB.
  157.   o Control-BREAK error exit.
  158.   o 18 communications error conditions trapped.
  159.   o Allows 4 ports to run concurrently (more with Digi/BOCA board).
  160.   o Complete modem control & status.
  161.   o Written in assembly language for small size & high speed.
  162.   o Terminal program featuring ASCII (with XON/XOFF), XMODEM,
  163.     YMODEM, & YMODEM-G.
  164.  
  165.  
  166.   Why should you buy PCL4W? Consider the following:
  167.  
  168.      COMPLETE  :  PCL4W is complete since it provides absolute control of the
  169.                   serial ports (including the high performance INS16550).
  170.  
  171.       COMPACT  :  PCL4W is very compact at less than 6 KB.  Your  application
  172.                   doesn't carry a lot of excess code.
  173.  
  174.          FAST  :  PCL4W is fast.  It will run at 115200 baud on all 80386 and
  175.                   up machines.
  176.  
  177.       SUPPORT   : If  you  get  stuck,   you will talk to the programmer that
  178.                   wrote the code, not a person hired to answer the phone.
  179.  
  180.           BBS  :  A user support BBS is available (2400 to 14400 baud, N81) in
  181.                   order to provide immediate support as necessary.
  182.  
  183.    NEWSLETTER  :  One year  subscription  to  the  MSC  newsletter discussing
  184.                   communications problems and solutions (published quarterly).
  185.  
  186.         PRICE  :  You get PCL4W for a very reasonable price !
  187.  
  188.      UPGRADES  :  Once  you  buy  PCL4W,  you can always update  to  the most
  189.                   recent version for a very reasonable cost.
  190.  
  191.    COMPATIBLE  :  PCL4W  is  call  for call compatible with the MSDOS based
  192.                   version PCL4C except for two functions in which delay  times
  193.                   are no longer necessary.
  194.  
  195.  
  196.   Our goal is to provide a robust serial communications library that that  you
  197.   and your customers can depend upon.
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  PCL4W Users Manual                                                Page 3
  205.   1.1 User Support
  206.  
  207.  
  208.   We want you to be successful in developing your applications using PCL4W! We
  209.   depend on our customers to let us know what they need  in  a  communications
  210.   library.   This  means we are committed to providing the best communications
  211.   library that we can. If you have any suggestions or comments, please let  us
  212.   know.
  213.  
  214.   If  you  are  having  a problem using PCL4W, call us at 205-881-4630 between
  215.   1:30PM and 9:30PM CST Monday through Friday. We  are  also  usually  in  the
  216.   office most mornings and Saturday afternoon.
  217.  
  218.   You  can  also  call at other times and leave a message, and call back later
  219.   for a reply. However, we can only answer questions with respect to using the
  220.   PCL4W library.  We cannot help you program your application.
  221.  
  222.   You  may  also  call  our User Support BBS (2400 to 14400 baud, no parity, 8
  223.   data bits, 1 stop bit) at 205-880-9748 and leave a message  (address  it  to
  224.   the SYSOP).  We will usually have a reply ready for you within 24 hours.
  225.  
  226.   The BBS  is  available  24  hours  per  day  except  at  2  PM  Sundays  for
  227.   maintenanace. All files are in standard ZIP format. The BBS will contain the
  228.   latest  shareware  version  of  all MarshallSoft products as well as related
  229.   files such as:
  230.  
  231.        BUGS.ZIP:  Bug report.
  232.        NEWS.ZIP:  Latest news regarding our products.
  233.  
  234.   If you are on the Internet, you can email us at msc@traveller.com.  You  can
  235.   also get the latest versions of our products from our anonymous ftp site:
  236.  
  237.         FTP:   ftp.traveller.com
  238.        PATH:   pub/users/msc
  239.  
  240.   The MarshallSoft  Computing,  Inc.   newsletter  "Comm  Talk"  is  published
  241.   quarterly.  It discusses various communications problems and solutions using
  242.   PCL4W  as  well  as related information. Registered users receive a one year
  243.   complimentary subscription  when  first  registering  and  for  each  update
  244.   purchased.
  245.  
  246.   Of  course,  you can always write to us. You should receive a reply within a
  247.   week or so. Please don't mail hardware without first talking to us.
  248.  
  249.  
  250.   1.2 ASP Ombudsman
  251.  
  252.  
  253.   MarshallSoft  Computing,  Inc.   is a member of the Association of Shareware
  254.   Professionals (ASP).  ASP wants to make sure that  the  shareware  principle
  255.   works  for  you.   If  you are unable to resolve a shareware-related problem
  256.   with an ASP member by contacting the member directly, ASP  may  be  able  to
  257.   help.  The  ASP  Ombudsman can help you resolve a dispute or problem with an
  258.   ASP member, but does not provide technical support  for  members'  products.
  259.   Please  write  to  the  ASP  Ombudsman  at 545 Grover Road, Muskegon, MI USA
  260.   49442-9427, Fax 616-788-2765, or send a CompuServe  message  via  CompuServe
  261.   Mail to ASP Ombudsman 70007,3536.
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  PCL4W Users Manual                                                Page 4
  273.   1.3 A Typical Application
  274.  
  275.  
  276.   In general, there are two classes of applications that use a  communications
  277.   library  like  PCL4W: those that use a modem to connect to the outside world
  278.   and those that connect directly to a peripheral device. In  either  case,  a
  279.   typical   application  program  using  PCL4W  might  consist  of  3  phases:
  280.   initialization, execution, and  termination.   The  following  code  segment
  281.   assumes a knowledge of the windows API.
  282.  
  283.   In  the  following  code  segment,  SioRxBuf is called to set up a 1024 byte
  284.   receive buffer; SioParms is called to set up the parity, stop bit count, and
  285.   word length; SioReset is called to set the baud rate to 9600 and  reset  the
  286.   UART (Universal Asynchronous Receiver / Transmitter).
  287.  
  288.  
  289.        case WM_CREATE:
  290.           /* initialization */
  291.           SioRxBuf(Port,RxBuffer,Size1024);
  292.           SioParms(Port,NoParity,OneStopBit,WordLength8);
  293.           SioReset(Port,Baud9600);
  294.  
  295.  
  296.   If you are using the version of  the  library  with  transmitter  interrupts
  297.   enabled  (PCL4W2.LIB),  then  SioTxBuf()  must  be  called  to  set  up  the
  298.   transmitter buffer. The transmit buffer must be distinct  from  the  receive
  299.   buffer.
  300.  
  301.  
  302.        case WM_CREATE:
  303.           /* initialization */
  304.           SioRxBuf(Port,TxBuffer,Size1024);
  305.           SioTxBuf(Port,RxBuffer,Size1024);
  306.           SioParms(Port,NoParity,OneStopBit,WordLength8);
  307.           SioReset(Port,Baud9600);
  308.  
  309.  
  310.   Characters can be  transmitted  and  received  once  the  required  port  is
  311.   initialized.   Before leaving your application, SioDone is called to restore
  312.   the prior state of the serial communications  system.   Forgetting  to  call
  313.   SioDone  before  exiting your application will leave the interrupt system in
  314.   an unuseable state and the machine will have to be re-booted.
  315.  
  316.  
  317.        case WM_DESTROY:
  318.           /* termination */
  319.           SioDone(Port);
  320.  
  321.  
  322.   If you are using a modem, you also need to be concerned  about  initializing
  323.   your  modem  correctly  and  handling  any  required flow control.  Refer to
  324.   Chapter 4.0, "Talking to Your Modem" for detailed information.
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  PCL4W Users Manual                                                Page 5
  341.   1.4 Installation
  342.  
  343.  
  344.   (1) Before installation of PCL4W , your Windows C compiler should already be
  345.   installed on your system and tested. If you are not familiar with makefiles,
  346.   refer  to  your compiler manual.  Examine the file "FILES.LST" for a list of
  347.   the distribution files.
  348.  
  349.   (2) Make a backup  copy  of  your  distribution  disk.   Put  your  original
  350.   distribution disk in a safe place.
  351.  
  352.   (3)  Create a work directory on your work disk (normally your harddisk). For
  353.   example, to create a work directory named PCL4W, we first log onto the  work
  354.   disk and then type:
  355.  
  356.                    MKDIR PCL4W
  357.  
  358.   (4)  Copy  all  the  files from your backup copy of the distribution disk to
  359.   your work directory.  For example, to copy from the A: drive  to  your  work
  360.   directory, we type:
  361.  
  362.                   CD PCL4W
  363.                   COPY A:*.*
  364.  
  365.   (5)  Compile SIMPLE.C and link with the PCL4W library (PCL4W.LIB).
  366.  
  367.   Makefiles are provided for each of the  supported  compilers.   If  you  are
  368.   unfamiliar  with  makefiles,  please  consult  your  compiler  manual. After
  369.   compiling with the provided  makefiles,  you  can  convert  to  a  Microsoft
  370.   Workbench  or Borland Integrated Development Environment project file if you
  371.   wish. Compile as follows:
  372.  
  373.           (a) Microsoft C: Type  NMAKE SIMPLE._M_
  374.  
  375.           (b) Borland C: Type  MAKER -fSIMPLE._B_
  376.  
  377.   SIMPLE.C  should  compile and link without any problems.
  378.  
  379.   NOTES: (1) Use NMAKE, not MAKE with Microsoft C
  380.          (2) Use MAKER, not MAKE with Borland C.
  381.  
  382.   (6) The recommended way to test  SIMPLE  is  to  run  it  on  two  computers
  383.   connected  by  a null modem cable.  Whatever is typed on one computer should
  384.   be displayed on the other. If you don't have  two  computers,  you  can  use
  385.   SIMPLE  to talk to your modem. Sending an "AT" to the modem should result in
  386.   an "OK" being sent back.
  387.  
  388.   (7) If you have downloaded the TERM test program (WTERM12.ZIP), be  sure  to
  389.   create  a  separate  directory  and  copy  all TERM files into it.  The TERM
  390.   program uses some functions of enhanced capability with  the  same  name  as
  391.   used by the SIMPLE program.
  392.  
  393.   Once you have become familiar with the PCL4W files  and  have  compiled  and
  394.   tested SIMPLE, you may want to re-organize your files into sub-directories.
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  PCL4W Users Manual                                                Page 6
  409.   2.0 Library Organization
  410.  
  411.  
  412.   The  PCL4W  library  is organized into six categories of functions. Refer to
  413.   the PCL Reference Manual (PCL4W.REF) for details on individual functions.
  414.  
  415.  
  416.   2.1 Configuration
  417.  
  418.  
  419.   There  are three functions in the configuration category.  SioPorts sets the
  420.   number of PC and DigiBoard / BOCA ports.  SioUART is used to change the UART
  421.   base address for a communications port  to  a  non-standard  address,  while
  422.   SioIRQ  is  used  to  assign a nonstandard IRQ line to a port.  (See Section
  423.   6.2, Standard Port Addresses for more details on standard UART addresses and
  424.   IRQ lines).
  425.  
  426.   The  configuration  functions  SioPorts,  SioUART  and SioIRQ must be called
  427.   before calling any other library functions.   Be  very  careful  when  using
  428.   these  functions.   Remember that your serial hardware must support the UART
  429.   and IRQ that you specify.  Always test any new configuration immediately.
  430.  
  431.        SioPorts : Sets number of PC and DigiBoard / BOCA ports.
  432.        SioUART  : Sets the UART base address.
  433.        SioIRQ   : Assigns an IRQ line to a port.
  434.  
  435.   THE IRQ GOLDEN RULE: You may open (via  SioReset)  only  one  port  per  IRQ
  436.   (except for the DigiBoard / BOCA board).
  437.  
  438.  
  439.   2.2 Initialization & Termination
  440.  
  441.  
  442.   There  are  nine  functions  in the initialization and termination category.
  443.   Together, SioGetDiv, SioFIFO, SioRxBuf, SioTxBuf,  and  SioReset  initialize
  444.   your  serial communications system.  Your application must call SioParms and
  445.   SioRxBuf before calling SioReset, and SioReset must  be  called  before  any
  446.   serial I/O processing can be done.
  447.  
  448.   After initialization, SioParms and SioBaud can be called again to change the
  449.   communications  parameters without resetting the serial port. SioFlow can be
  450.   called to enable hardware flow control.
  451.  
  452.   Before exiting from your application, SioDone must  be  called.  Failure  to
  453.   call SioDone can crash your system later.
  454.  
  455.        SioRxBuf   : Sets up receive buffer.
  456.        SioTxBuf   : Sets up transmitter buffer.
  457.        SioFIFO    : Sets the interrupt level for the INS16550.
  458.        SioParms   : Sets parity, stop bits, and word length.
  459.        SioReset   : Initialize a serial port for processing.
  460.        SioDone    : Terminates further serial processing.
  461.        SioBaud    : Sets the baud rate of the selected port.
  462.        SioFlow    : Enables / disables flow control.
  463.        SioGetDiv  : Gets the baud rate divisor.
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  PCL4W Users Manual                                                Page 7
  477.   2.3 Modem Control & Status
  478.  
  479.  
  480.   There  are  eight  functions  in the modem control and status category which
  481.   provide your application with complete control over the status  and  control
  482.   bits of your modem.
  483.  
  484.   There  are  two modem control bits, "Data Terminal Ready" (DTR) and "Request
  485.   To Send" (RTS). These bits can be  read,  set,  or  cleared  by  SioDTR  and
  486.   SioRTS.
  487.  
  488.   There  are  four  modem status bits, "Data Set Ready" (DSR), "Clear To Send"
  489.   (CTS), "Ring Indicator" (RI), and "Data Carrier Detect" (DCD). SioModem  can
  490.   read  any  of  the modem status bits.  SioDSR, SioCTS, SioRI, and SioDCD can
  491.   only read their respective modem status bit.
  492.  
  493.   Refer to the chapter entitled "RS232 Signals" for a discussion  of  each  of
  494.   the control and status bits.
  495.  
  496.        SioDTR   : Set, clear, or read the Data Terminal Ready (DTR) bit.
  497.        SioRTS   : Sets, clears, or reads the Request to Send (RTS) line.
  498.        SioModem : Reads the modem status register.
  499.        SioDSR   : Reads the Data Set Ready (DSR) modem status bit.
  500.        SioCTS   : Reads the Clear to Send (CTS) modem status bit.
  501.        SioDCD   : Reads the Data Carrier Detect (DCD) modem status bit.
  502.        SioRI    : Reads the Ring Indicator (RI) modem status bit.
  503.        SioRead  : Reads the contents of the 7 UART registers.
  504.  
  505.  
  506.   2.4 Serial I/O
  507.  
  508.  
  509.   There  are  eight  library  functions  in the serial I/O category. Together,
  510.   these functions give the programmer complete control over serial I/O. Higher
  511.   level functions such as protocols and  smart  modem  communications  can  be
  512.   completely  implemented  in  terms  of these functions. Refer to the example
  513.   code.
  514.  
  515.   SioGetc and SioPutc perform all the actual serial I/O.   SioUnGetc  "ungets"
  516.   the  last  serial  byte  read.  SioRxFlush  clears  the  receive queue while
  517.   SioTxFlush clears the transmit queue. SioLine can be used to test  for  UART
  518.   errors.   SioRxQue  returns  the  number of bytes in the receive queue while
  519.   SioTxQue returns the number of bytes in the transmit queue.
  520.  
  521.        SioGetc    : Reads the next character from the serial line.
  522.        SioPutc    : Transmit a character over a serial line.
  523.        SioUnGetc  : "Un:gets" (puts back) a specified character.
  524.        SioRxFlush : Flush (clears) the receive buffer.
  525.        SioRxQue   : Returns the number of characters in the RX queue.
  526.        SioTxFlush : Flush (clears) the transmit buffer.
  527.        SioTxQue   : Returns the number of characters in the TX queue.
  528.        SioLine    : Reads the line status register.
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  PCL4W Users Manual                                                Page 8
  545.   2.5 Error Detection
  546.  
  547.  
  548.   There are two functions in the error detection category. They are  concerned
  549.   with  detecting  or reporting communications errors.  Use of these functions
  550.   can make your application significantly more robust.
  551.  
  552.   SioBrkSig can read or  modify  the  UART  break  bit.  This  is  useful  for
  553.   signalling   the   remote  system  that  a  fatal  condition  has  occurred.
  554.   SioLoopBack can be used to test the integrity of your UART.
  555.  
  556.   There is also a file SIOERROR.C which contains the function  SioError  which
  557.   displays  a  error  message  corresponding  to an error code returned from a
  558.   PCL4W function (every PCL4W function returns a code).
  559.  
  560.        SioBrkSig   : Asserts, cancels, or detects the RS232 BREAK  signal.
  561.        SioError    : Displays  error  in  text.
  562.        SioLoopBack : Performs a UART loopback test.
  563.  
  564.  
  565.   2.6 General Support
  566.  
  567.  
  568.   There is one function in the general support category. SioInfo  returns  the
  569.   version  number  of  the  library  and  whether  transmitter  interrupts are
  570.   enabled.
  571.  
  572.        SioInfo      : Returns the library version, memory model, the number of
  573.                       transmitter interrupts, and receiver interrupts.
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  PCL4W Users Manual                                                Page 9
  613.   3.0 Library Overview
  614.  
  615.  
  616.   3.1 Dynamic Link Libraries
  617.  
  618.  
  619.   PCL4W is provided as a dynamic link library (DLL). A DLL is characterized by
  620.   the fact that it need not be loaded until required by an application program
  621.   and that only one copy of the DLL is necessary regardless of the  number  of
  622.   application  programs  that  use it. Contrast this to the traditional static
  623.   library which is bound to each and every application that uses  it  at  link
  624.   time.
  625.  
  626.   Since  PCL4W is a DLL, only one copy of the PCL4W code & data is loaded into
  627.   memory regardless of the number of applications programs that use it.
  628.  
  629.   For example, more than one instance  of  the  test  program  SIMPLE  can  be
  630.   started.   All  copies of SIMPLE can run concurrently as long as each uses a
  631.   different COM port.
  632.  
  633.  
  634.   3.2 DOS Protected Mode Interface
  635.  
  636.  
  637.   Windows itself uses what is known as  the  "DOS  Protected  Mode  Interface"
  638.   (DPMI)  to  control  changing  states  (protected  vs real), controlling the
  639.   interrupt system, etc.  This is necessary because Windows  itself  typically
  640.   runs  in  a  protected  state  and must change to real state in order to use
  641.   MSDOS services.
  642.  
  643.   The  PCL4W  library  uses  this same DPMI mechanism. In particular, the file
  644.   USE_DPMI.ASM contains the necessary functions for using DPMI. The  developer
  645.   should not modify USE_DPMI.ASM in any way.
  646.  
  647.  
  648.   3.3 Memory Models
  649.  
  650.  
  651.   Most windows programs are small or medium memory model programs since  these
  652.   memory models are limited to one data segment.  However, all PCL4W functions
  653.   are FAR functions, so they can be used with any memory model. Thus, there is
  654.   just one PCL4W.DLL and PCL4W.LIB regardless of the memory model used.
  655.  
  656.  
  657.   3.4 Using the Library
  658.  
  659.  
  660.   The PCL4W has been tested on a TANDY 3000 (80286 IBM AT  clone),  a  Gateway
  661.   2000 25 MHZ 80386-DX, and a Gateway 2000 66MHZ 80486-DX2.
  662.  
  663.   Please examine the PCL4W.H file. Note that COM1 is defined as port zero, not
  664.   port  one.   The  user must assume the responsibilty for passing the correct
  665.   information when calling PCL4W functions.
  666.  
  667.   If there are any conflicts between PCL4W  definitions  and  those  in  other
  668.   libraries,  the PCL4W definitions can be changed in the PCL4W.H file and any
  669.   file that uses the definition. There is no change necessary for the  library
  670.   code itself.
  671.  
  672.   If  you  write  an  application  using  the PCL4W library, don't run another
  673.   application that uses the same communications port.
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  PCL4W Users Manual                                                Page 10
  681.   3.5 Example Programs
  682.  
  683.  
  684.   Two  communications  programs  are  provided as a demonstration of the PCL4W
  685.   library: SIMPLE and TERM.
  686.  
  687.   SIMPLE  is  provided  as  the  easiest example of communications programming
  688.   using PCL4W.  The user should compile and link SIMPLE.C as  a  test  of  the
  689.   library.
  690.  
  691.   If you have two computers, connect them together with a null modem cable and
  692.   run SIMPLE on both machines.  The baud rate in SIMPLE is hard coded to  2400
  693.   baud. It is easily changed in the source code. Start SIMPLE by typing SIMPLE
  694.   followed by the port.
  695.  
  696.   The  TERM  program  is  a  more  capable  terminal  emulator than SIMPLE. It
  697.   features modem initialization, hardware flow control, and state driven  file
  698.   transfer  using  ASCII,  XMODEM, and YMODEM, communications protocols.  TERM
  699.   can be used to call up any bulletin board system, including the MarshallSoft
  700.   Computing BBS.
  701.  
  702.   Refer to Chapter 7.0, Example Programs on SIMPLE and  TERM  in  this  manual
  703.   for more detailed information.
  704.  
  705.  
  706.   3.6 Making the Library
  707.  
  708.  
  709.   Registered  users  may  wish  to  assemble PCL4W.ASM.  Use the /MX switch in
  710.   order to disable automatic conversion from lower case to upper case.  If the
  711.   /MX switch is not used, then all PCL4W function references in C code must be
  712.   in upper case. To assemble using the Microsoft assembler, use  the  provided
  713.   makefile "PCL4W.MAK". Type
  714.  
  715.        nmake pcl4w.mak
  716.  
  717.   Two  libraries  are  made, one with transmitter interrupts disabled (PCL4W1)
  718.   and one with transmitter interrupts enabled (PCL4W2). Most users should  use
  719.   the  library  without transmitter interrupts enabled since they require less
  720.   overhead.
  721.  
  722.   To use the PCL4W library without transmitter interrupts enabled, type
  723.  
  724.        copy pcl4w1.lib pcl4w.lib
  725.        copy pcl4w1.dll pcl4w.dll
  726.  
  727.   To use the PCL4W library with transmitter interrupts enabled, type
  728.  
  729.        copy pcl4w2.lib pcl4w.lib
  730.        copy pcl4w2.dll pcl4w.dll
  731.  
  732.  
  733.   After creating PCL4W.LIB and PCL4W.DLL, the example programs can be compiled
  734.   and linked. Refer to Chapter 7.0, "Example Programs".
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  PCL4W Users Manual                                                Page 11
  749.   4.0 Talking to Your Modem
  750.  
  751.  
  752.   A  modem  is  used  to  extend  the distance over which you may communicate.
  753.   Without a modem, your RS232 cable is limited to a maximum  of  approximately
  754.   50 feet.  But with a modem, you can communicate literally around the world.
  755.  
  756.  
  757.   4.1 Modem Standards
  758.  
  759.  
  760.   Two modems can communicate over a telephone line only if they are both using
  761.   the  same  signaling frequencies and modulation, which are determined by the
  762.   the modem standards used.  Modem standards can be divided into  three  sets:
  763.   (1) speed, (2) data compression used, and (3) error control.
  764.  
  765.   The  Bell  standards  (103  &  212A)  are  those  of  AT&T.   The CCITT (The
  766.   International Consultative Committee for Telephone and Telegraph)  standards
  767.   are designated as "V. ".
  768.  
  769.  
  770.   Speed
  771.  
  772.  
  773.        Bell 103  :   300 baud
  774.        Bell 212A :  1200 baud
  775.        V.21      :   300 baud
  776.        V.22bis   :  1200 & 2400 baud
  777.        V.32      :  4800 & 9600 baud
  778.        V.32bis   :  4800, 7200, 9600, 12000, and 14400 baud
  779.  
  780.  
  781.   Data Compression
  782.  
  783.  
  784.        MNP 5     :  Microcom Networking Protocol (proprietary).
  785.        V.42bis   :  International data compression standard.
  786.  
  787.  
  788.   Error Control
  789.  
  790.  
  791.        MNP 2,3,4 :  Three level error correction (public domain).
  792.        V.42      :  International error correction standard.
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  PCL4W Users Manual                                                Page 12
  817.   4.2 Flow Control
  818.  
  819.  
  820.   With  modems  using data compression, the modem to modem connection will run
  821.   at various speeds depending on the quality of the  line.   The  computer  to
  822.   modem  connection  will be at a fixed baud rate. Therefore, a protocol (flow
  823.   control) is necessary to synchronize the data flow between a modem  and  the
  824.   computer  to  which  it  is  connected.   Refer  to  your  modem  manual for
  825.   information on flow control protocols supported.
  826.  
  827.   Two flow control protocols are used by most all modems  which  require  flow
  828.   control.  Software  flow  control  is called "XON/XOFF" (other software flow
  829.   control character pairs are defined but operate the same  as  XON/XOFF)  and
  830.   hardware  flow  control is called "RTS/CTS".  Most modems which require flow
  831.   control enable hardware flow control by default.
  832.  
  833.   In XON/XOFF (software) flow control, the computer suspends transmitting data
  834.   if it receives a XOFF character (13  hex)  from  the  modem,  and  continues
  835.   transmitting  when  it  receives  a XON character (11 hex).  Similiarly, the
  836.   computer can signal the modem not to send any more data  by  transmitting  a
  837.   XOFF  to  it,  and  can tell the modem to continue transmission be sending a
  838.   XON.
  839.  
  840.   In RTS/CTS (hardware) flow control, the RTS line is used by the computer  to
  841.   signal  the  modem  ,  while the CTS line is used by the modem to signal the
  842.   computer.  The RTS line is set OFF by the computer  to  tell  the  modem  to
  843.   suspend  transmission,  and  set  to  ON  to  tell  the  modem  to  continue
  844.   transmission.  The CTS line is set to OFF by the modem to tell the  computer
  845.   to  stop  transmitting,  and  set  to  ON  to  tell the computer to continue
  846.   transmitting.
  847.  
  848.   Given the choice, always choose hardware flow  control  over  software  flow
  849.   control  so  that  all  data  transmission is transparent.  If hardware flow
  850.   control is not the default (which it almost always is),  you  should  modify
  851.   your modem initialization string to turn hardware flow control on.
  852.  
  853.  
  854.   4.3 MODEM_IO Functions
  855.  
  856.   The  file  MODEM_IO.C  contains  several  state  driven  functions that ease
  857.   communicating with your modem. Look in the TERM.C code for examples of their
  858.   use.
  859.  
  860.        ModemSendTo   : Sends string to modem.
  861.        ModemQuiet    : Waits for continuous quiet.
  862.        ModemWaitFor  : Waits for particular string from modem.
  863.        ModemHangup   : Hangs up modem.
  864.        ModemDriver   : State Driver for the above functions.
  865.  
  866.        ModemResult   : Gets result of last completed WaitFor.
  867.        ModemFunction : Gets last MODEM_IO function.
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  PCL4W Users Manual                                                Page 13
  885.   4.4 Modem Initialization
  886.  
  887.  
  888.   If your application uses a modem (as opposed to using a null  modem  cable),
  889.   then  you should always send an initialization string to your modem if it is
  890.   a programmable modem such as those made by  Hayes.   Communication  programs
  891.   such as PROCOMM and TELIX always send such a string automatically as soon as
  892.   they start up.
  893.  
  894.   The particular initialization string depends on the make of your modem.  For
  895.   Hayes  and  Hayes  AT  command  set  compatible modems, the following string
  896.   (followed by a carriage return) should work:
  897.  
  898.        AT E1 S7=60 S11=60 V1 X1 Q0 S0=0
  899.  
  900.   Refer to your Modem User's Guide for a full discussion of these commands.  A
  901.   brief description is as follows:
  902.  
  903.        AT     Modem attention command.
  904.        E1     Modem will echo what you send to it.
  905.        S7=60  Wait 60 seconds for carrier and/or dial tone.
  906.        S11=60 Use 60 milliseconds for tone dialing duration & spacing.
  907.        V1     Display result code as words (not numbers).
  908.        X1     Use the extended result message (CONNECT XXXX) set.
  909.        Q0     Modem returns result codes.
  910.        S0=0   Do not answer RING.
  911.  
  912.   If  your application will answer incoming calls, then set the S0 register to
  913.   the ring on which to automatically answer.
  914.  
  915.   If you send the above codes by using SioPutc (as opposed to typing them from
  916.   the keyboard), then follow these guidelines:
  917.  
  918.   (1) Send an initial carriage return before the initialization string.
  919.  
  920.   (2) Pause at least 150 milliseconds after each character sent as your  modem
  921.   needs the time to perform its own internal processing. Pause a little longer
  922.   if your modem is not accepting your initialization string.
  923.  
  924.   (3)  Pause  one  and a half seconds after sending any initialization command
  925.   such as ATZ or AT&F since your modem must do quite a bit of processing.
  926.  
  927.   If you experience any problems in initializing your Hayes modem, you  should
  928.   first reset it to factory settings by sending:
  929.  
  930.        AT&F
  931.  
  932.   Refer to the TERM program (function SendToModem in the file MODEM_IO.C)  for
  933.   an example of sending an initialization string to a Hayes compatible modem.
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  PCL4W Users Manual                                                Page 14
  953.   5.0 Problems
  954.  
  955.  
  956.   If  you  cannot  get your application to run properly, first compile and run
  957.   the terminal emulator program SIMPLE provided  on  your  distribution  disk.
  958.   Test  SIMPLE  by  connecting  two  computers  with  a null modem cable or by
  959.   commanding a Hayes AT command set compatible modem.
  960.  
  961.   Once SIMPLE runs, compile and run the TERM program.  If you are using a null
  962.   modem  cable  or a non-programmable modem, be sure to set the HAYES constant
  963.   to 0 in the source code (#define AT_COMMAND_SET 0). If you are using a Hayes
  964.   compatible modem, set the AT_COMMAND_SET constant to 1.  If you are using  a
  965.   programmable  modem  which is not Hayes compatible, then you must modify the
  966.   initialization string for your particular modem.
  967.  
  968.   If your application does not run but TERM runs correctly, then you have most
  969.   likely  made  a  programming  mistake  in  your  application.   MarshallSoft
  970.   Computing  cannot  debug  your  application,  especially over the telephone!
  971.   However, consider each of the following when searching for an error in  your
  972.   application.
  973.  
  974.   1.  Have you included the file PCL4W.H in your application ?
  975.  
  976.   2.  Is your receive buffer large enough ? If you are using 1K data blocks in
  977.   YMODEM,  then  your  receive  buffer should be at least 1K (2K if baud rates
  978.   above 19200 are to be used).
  979.  
  980.   3.  Have you selected too high a baud rate? Windows can multitask many tasks
  981.   at once. You may have to lower your baud rate (or get 16550 UARTS).
  982.  
  983.   4.  If you are running two COM ports simultaneously, are you using separate
  984.   receive and transmits buffers ? (you should).
  985.  
  986.   5.  Did SioReset return a zero value ?  If not, then you must call  SioReset
  987.   again. See TERM.C for an example.
  988.  
  989.   6.   Did  you  send the proper initialization string to your modem ? Did you
  990.   set DTR and RTS ? (you should).
  991.  
  992.   7.  Do you have more than one COM1 port?  For example, if you  have  a  COM1
  993.   port  on  your  motherboard, you cannot add another COM1 port or modem board
  994.   that uses COM1 without first disabling the COM1 on the motherboard.
  995.  
  996.   8.   Is  your  IRQ set correctly? If you can transmit data but can't receive
  997.   using the PCL4W library with transmitter interrupts disabled (PCL4W2),  then
  998.   this usually means that interrupts are not working.
  999.  
  1000.   9. If -19 is returned from SioReset, this means that  you  have  not  called
  1001.   PostMainHandle() from within your code first. See example in SIMPLE.C.
  1002.  
  1003.   We recommend the following steps if you believe that you have  discovered  a
  1004.   bug  in  the  library:  (1)  Create  the  smallest,  simpliest  test program
  1005.   possible that demonstates the  problem.  (2)  Document  your  exact  machine
  1006.   configuration  and  what error the test program demonstates.  (3) Upload the
  1007.   example source to our user support BBS or mail us a disk.
  1008.  
  1009.   If  the  problem can be solved with an easy work-around, we will publish the
  1010.   work-around.  If the problem requires a modification to the library, we will
  1011.   make the change and make the modified library  available  to  our  customers
  1012.   without charge.
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  PCL4W Users Manual                                                Page 15
  1021.   6.0 Serial Communications
  1022.  
  1023.   6.1 Communications Basics
  1024.  
  1025.  
  1026.   The  heart  of  serial  communications  is  the UART (Universal Asynchronous
  1027.   Receiver Transmitter).  The IBM  PC/XT/AT  and  compatibles  use  the  8250,
  1028.   16450, or the 16550 UART.  The purpose of the UART is:
  1029.  
  1030.   (1) To convert bytes from the CPU (Central Processing Unit), into  a  serial
  1031.   format  by  adding  the  necessary start, stop, and parity bits to each byte
  1032.   before transmission, and to then transmit each bit at the correct baud rate.
  1033.  
  1034.   (2) To convert the incoming stream (at a specified baud rate) of serial bits
  1035.   into bytes by removing the start, stop, and parity bits  before  being  made
  1036.   available to the CPU.
  1037.  
  1038.   The  UART  is part of the serial interface circuitry which allows the CPU to
  1039.   send and receive signals over the RS232 lines. This  can  be  diagrammed  as
  1040.   follows:
  1041.  
  1042.  
  1043.  
  1044.                         Serial Interface
  1045.                      +-------------------+
  1046.                      |                   |
  1047.   +-----+  Data Bus  |     +------+      |    RS232 Signals
  1048.   | CPU +------------+     | UART |      +----------------*
  1049.   +-----+            |     +------+      |
  1050.                      |                   |
  1051.                      +-------------------+
  1052.  
  1053.  
  1054.  
  1055.   The  8250/16450/16550  UART  is  capable  of  operating in one of two modes,
  1056.   "polled" and "interrupt driven".  The serial communications functions in the
  1057.   BIOS uses the polled method.  In this approach, the CPU is  typically  in  a
  1058.   loop  asking  the  UART  over  and over again if it has a byte ready. If its
  1059.   does, the polling code returns the byte.  But, if the  next  byte  comes  in
  1060.   before the polling code is executing again, then that byte is lost.
  1061.  
  1062.   In the interrupt driven approach (used by PCL4W), when a byte is received by
  1063.   the  UART,  an  "Interrupt  Service  Routine" (ISR) is executed immediately,
  1064.   suspending temporarily whatever else is executing. The ISR  then  moves  the
  1065.   byte to a buffer so that your application program can later read it.
  1066.  
  1067.   If transmitter interrupts are enabled, then  bytes  are  queued  up  waiting
  1068.   transmission.   When  a  byte  is  moved  from  the UART transmitter holding
  1069.   register to the UART transmitter shift register, an interrupt  is  generated
  1070.   and  the  next  byte is taken from the library transmitter buffer by the ISR
  1071.   and written to the UART holding register.
  1072.  
  1073.   Up to 16 bytes can be taken from the transmitter buffer while processing one
  1074.   transmitter  interrupt  if an 16550 UART is used. The 16550 UART is strongly
  1075.   recommended for computers doing serial communications under Windows.
  1076.  
  1077.   Refer to Sections  6.6  and  6.7  entitled  "RS232  Signals"  and  "National
  1078.   INS8250,   INS16450,   and   INS16550   UARTs",   respectively  for  further
  1079.   information on these topics.
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  PCL4W Users Manual                                                Page 16
  1089.   6.2 Standard Port Addresses
  1090.  
  1091.  
  1092.   There  are  a  few  things to know about how serial communications ports are
  1093.   used by IBM PC/XT/AT and compatible computers.  The  standard  IBM  PC/XT/AT
  1094.   configuration values are as follows:
  1095.  
  1096.         Port     Reg Base   IRQ Line   Vector
  1097.         COM1        3F8H         4        12
  1098.         COM2        2F8H         3        11
  1099.         COM3        3E8H         4        12
  1100.         COM4        2E8H         3        11
  1101.  
  1102.   (Refer  to  your  DigiBoard  manual  for  DigiBoard addresses, and your BOCA
  1103.   manual for BOCA board addresses).
  1104.  
  1105.   PCL4W  assumes the above values.  If necessary, the UART base address can be
  1106.   changed by SioUART, and IRQ lines can be re-assigned  by  SioIRQ.   Remember
  1107.   that  each  port to be used concurrently must have a unique IRQ line.  Refer
  1108.   to the PCL4W Reference Manual for specific details.
  1109.  
  1110.   When installing new  communications  cards,  the  following  guidelines  are
  1111.   recommended:
  1112.  
  1113.   (1)  Be  sure to read the documentation for the hardware you are installing.
  1114.   Pay special attention to UART base addresses and IRQ lines, particularly  if
  1115.   trying to set up a non-standard configuration.
  1116.  
  1117.   (2)  If  you  have  a  choice in base addresses and IRQ lines, always choose
  1118.   standard values as defined above.
  1119.  
  1120.   (3) The first port should be COM1, the second COM2, etc.
  1121.  
  1122.   (4)  Use SioUART to zero all unused ports (for example, call SioUART(COM4,0)
  1123.   if there is no COM4 port installed).
  1124.  
  1125.   (5) Be carefull not to configure two ports for the  same  address.  This  is
  1126.   easier to do than you may believe.
  1127.  
  1128.   (6)  Choose  an  external  modem over an internal one.  It is much easier to
  1129.   debug problems with an external modem than an internal one.
  1130.  
  1131.   (7) Select hardware flow control (RTS/CTS) if flow control is  required  and
  1132.   hardware flow control is not the default.
  1133.  
  1134.   (8)  Always  test your port as soon as it is installed. Try several programs
  1135.   that use the communications ports.
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  PCL4W Users Manual                                                Page 17
  1157.   6.3 Running 3 or 4 Ports Concurrently
  1158.  
  1159.  
  1160.   PCL4W supports up to 4 serial ports running concurrently (more if you have a
  1161.   DigiBoard or BOCA board).  One free interrupt for  each  port  is  required.
  1162.   Refer to the next section if you have a DigiBoard or BOCA board.
  1163.  
  1164.   Interrupts IRQ4 and IRQ3 are dedicated to  the  communications  ports  in  a
  1165.   standard  IBM  PC/XT/AT configuration.  IRQ4 is shared between COM1 and COM3
  1166.   while IRQ3 is shared between COM2 and COM4.  This means that you can run two
  1167.   ports simultaneously provided that they don't share an interrupt.
  1168.  
  1169.   Suppose that you wish to run 3 ports simultaneously. To begin, you must have
  1170.   3 serial UARTs installed on your computer.  Assume,  for  purposes  of  this
  1171.   discussion,  that  COM1  is installed on your motherboard, and that you have
  1172.   purchased a new 2 port serial communications board.
  1173.  
  1174.   You should be able to configure the first serial board port as  COM2,  which
  1175.   uses IRQ3.  Refer to the manual that came with your serial board.
  1176.  
  1177.   In  order  to  run the third serial port concurrently with the first two, an
  1178.   unused interrupt must be found.  If your serial card can use only  IRQ3  and
  1179.   IRQ4,  then there is no way to run a third line since IRQ4 and IRQ3 are used
  1180.   for COM1 and COM2.
  1181.  
  1182.   However, many serial cards can use other IRQs, typically IRQ2 through  IRQ7.
  1183.   Since  IRQ5  is  normally  used  for  a  second  printer  port, it is a good
  1184.   candidate for COM3. To use IRQ5 for the third serial port,  first  set  your
  1185.   serial card to use IRQ5 for COM3 (refer to your serial card manual) and then
  1186.   add the following line to your applications code before calling SioReset:
  1187.  
  1188.        SioIRQ(COM3,IRQ5);
  1189.  
  1190.   Don't  forget  to  disable  any device that might use IRQ5, such as a second
  1191.   printer port or a music card.   Unfortunately,  there  is  no  easy  way  to
  1192.   determine  that  you have no conflicts until you actually attempt to use the
  1193.   IRQ. If there are conflicts, your system will probably  hang  and  you  will
  1194.   have to reboot.
  1195.  
  1196.   To  run  a  fourth  serial  port,  another  free IRQ must be found.  On some
  1197.   systems, IRQ7 can be used. You must first disable IRQ7 on your parallel port
  1198.   card first (your printer doesn't need an IRQ). To use IRQ7  for  the  fourth
  1199.   serial port, first set your serial card to use IRQ7 for COM4 and then add:
  1200.  
  1201.        SioIRQ(COM4,IRQ7);
  1202.  
  1203.   To  summarize,  your  serial  card must be able to generate the correct IRQ,
  1204.   which is not already being used. Refer to the entry for the SioIRQ  function
  1205.   in the PCL4W Reference Manual.
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  PCL4W Users Manual                                                Page 18
  1225.   6.4 Using Multiport Cards
  1226.  
  1227.  
  1228.   The  PCL4W  library supports the dumb Digiboard (PC/4 and PC/8) and the dumb
  1229.   BOCA board (BB1004, BB1008, and BB2016).   Most  multiport  boards  will  be
  1230.   compatible  with either the DigiBoard (the status register contains the port
  1231.   number), or the BOCA board (the status register is bit mapped).
  1232.  
  1233.   6.4.1 The DigiBoard
  1234.  
  1235.   In order to use the DigiBoard, (not the Intelligent Digiboards such  as  the
  1236.   PC/Xe  and  PC/Xi) you must configure PCL4W using the SioPorts(), SioUART(),
  1237.   and SioIRQ() functions.
  1238.  
  1239.   Your  PCs  ports  must be partitioned into "standard" PC ports and dumb card
  1240.   ports.  Remember that standard PC ports cannot share IRQs like the DigiBoard
  1241.   (or BOCA board) can. If you are using IRQ4 and IRQ3 for  standard  PC  ports
  1242.   COM1  and  COM2, then you cannot use either for DigiBoard ports (try IRQ5 or
  1243.   IRQ7).
  1244.  
  1245.   Suppose that COM1 through COM2 are standard PC ports (using IRQ4  and  IRQ3)
  1246.   and  you  have  installed  a  PC/8  DigiBoard  that you wish to use for COM3
  1247.   through COM10 using interrupt line IRQ5.  You choose to use the  recommended
  1248.   DigiBoard UART addresses starting at 0x100:
  1249.  
  1250.      SioPorts(10,COM3,0x140,DIGIBOARD);/* COM3 = 1st DigiBoard port */
  1251.      Address  = 0x100;                 /* 1st DigiBoard UART address */
  1252.      for(Port=COM3;Port<=COM10;Port++) /* look at each port    */
  1253.        {SioUART(Port,Address);         /* set the UART address */
  1254.         Address += 8;                  /* compute next address */
  1255.         SioIRQ(Port,IRQ5);             /* set the DigiBoard IRQ */
  1256.        }
  1257.  
  1258.   The DigiBoard uses 0x140 for the status address for odd interrupts and 0x141
  1259.   for even interrupts.
  1260.  
  1261.   Digiboard  may  be  contacted  at  6400 Flying Cloud Drive, Eden Prairie, MN
  1262.   55344.  Telephone 612-943-9020 or FAX 612-943-5398.
  1263.  
  1264.  
  1265.   6.4.2 The BOCA Board
  1266.  
  1267.   In  order  to  use  the dumb BOCA Boards, you must configure PCL4W using the
  1268.   SioPorts(), SioUART(), and SioIRQ() functions.
  1269.  
  1270.   For example, to configure the BOCA BB2016 to use COM1 to  COM16,  with  base
  1271.   addresses starting at 0x100 and IRQ5:
  1272.  
  1273.      SioPorts(16,COM1,0x107,BOCABOARD);/* COM3 = 1st BOCA board port */
  1274.      Address = 0x100;                  /* 1st BOCA UART address */
  1275.      for(Port=COM1;Port<=COM16;Port++) /* look at each port    */
  1276.        {SioUART(Port,Address);         /* set the UART address */
  1277.         Address += 8;                  /* compute next address */
  1278.         SioIRQ(Port,IRQ5);             /* set the BOCA IRQ */
  1279.        }
  1280.  
  1281.   BOCA may be contacted at BOCA Research, Inc., 6413  Congress  Avenue,  Suite
  1282.   130, Boca Raton, FL 33487.  Phone 407-241-8088, FAX 407-997-0918.
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  PCL4W Users Manual                                                Page 19
  1293.   6.5 Transmitter Interrupts
  1294.  
  1295.  
  1296.   Transmitter interrupts are supported by the library.  Separate libraries are
  1297.   provided, one with transmitter interrupts enabled  and  one  without.   When
  1298.   transmitter  interrupts  are  NOT  enabled, the following logic occurs every
  1299.   time you call SioPutc():
  1300.  
  1301.    1. Wait for transmit buffer to become empty. The transmit  buffer  may  not
  1302.   be empty if the previous transmit is not completed (the UART breaks down the
  1303.   byte  &  sends  1  bit at a time). 2. When the transmit buffer is empty, the
  1304.   byte from the SioPutc() call is loaded into the transmit buffer and  control
  1305.   is returned to the caller.
  1306.  
  1307.   Note that you can not write to the UART any faster the the UART baud rate.
  1308.  
  1309.   When transmitter interrupts are enabled, the byte from SioPutc() is put into
  1310.   a previously prepared (by SioTxQue) transmitter queue. The interrupt service
  1311.   routine fetches bytes from this queue as soon as the previous byte has  been
  1312.   sent.
  1313.  
  1314.   While you can now call SioPutc() faster than the baud rate, bytes are  still
  1315.   transmitted at the given baud rate.
  1316.  
  1317.   The   above   sounds   like  transmitter  interrupts  are  the  way  to  go.
  1318.   Unfortunately, this is usually NOT the case.  Most applications will perform
  1319.   better if transmitter interrupts are NOT enabled.
  1320.  
  1321.   The reason is that transmitter interrupts double the amount of code  in  the
  1322.   time  critical interrupt service routine.  While the library is processing a
  1323.   transmitter interrupt (which can take a while), incoming bytes  can  not  be
  1324.   processed.  What this means is that a given machine can run at a higher baud
  1325.   rate without transmitter interrupts. This problem is compounded when running
  1326.   multiple ports simultaniously.
  1327.  
  1328.   However,  there are a few application areas where transmitter interrupts are
  1329.   preferable.  If your application will be  transmitting  blocks  of  data  at
  1330.   fairly slow baud rates you might profit from enabling transmitter interrupts
  1331.   provided  that there is something else for the processor to do (which is NOT
  1332.   the case in most protocols).
  1333.  
  1334.   However,  if  you are using 16550 UARTS (which have 16 byte on-chip transmit
  1335.   and receive buffers rather that the 1 byte buffers on  the  8250  and  16450
  1336.   UARTS),  you  may  want  to  use the library version with interrupts enabled
  1337.   provided that you enable the 16550 UART with the SioFIFO() function.
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  PCL4W Users Manual                                                Page 20
  1361.   6.6 RS-232 Signals
  1362.  
  1363.  
  1364.   RS-232 is the name of the serial data interface  standard  used  to  connect
  1365.   computers  to modems.  Most IBM compatible computers are built with at least
  1366.   one serial port and use either DB9 (9 pin) or DB25 (25 pin) connectors.
  1367.  
  1368.   A summary of these pins and  their  function  follows.   For  more  detailed
  1369.   information, refer to one of the many books dealing with RS-232 interfacing.
  1370.  
  1371.   Signal Ground Pin 7 (DB25), Pin 5 (DB9)
  1372.  
  1373.   The  SG  line  is  used  as  the  common  signal  ground, and must always be
  1374.   connected.
  1375.  
  1376.   Transmit Data Pin 2 (DB25), Pin 3 (DB9)
  1377.  
  1378.   The TX line is used to carry data from the computer to the modem.
  1379.  
  1380.   Receive Data Pin 3 (DB25), Pin 2 (DB9)
  1381.  
  1382.   The RX line is used to carry data from the modem to the computer.
  1383.  
  1384.   Data Terminal Ready Pin 20 (DB25), Pin 4 (DB9)
  1385.  
  1386.   The DTR line is used by the computer to signal the modem that it  is  ready.
  1387.   DTR should be set high when talking to a modem.
  1388.  
  1389.   Data Set Ready Pin 6 (DB25), Pin 6 (DB9)
  1390.  
  1391.   The DSR line is used by the modem to signal the computer that it is ready.
  1392.  
  1393.   Request to Send Pin 4 (DB25), Pin 7 (DB9)
  1394.  
  1395.   The  RTS  line  is used to "turn the line around" in half duplex modems, and
  1396.   for hardware flow control in most modems that require flow control.  RTS  is
  1397.   controlled by the computer and read by the serial device (modem).
  1398.  
  1399.   Clear to Send Pin 5 (DB25), Pin 8 (DB9)
  1400.  
  1401.   The  CTS  line  is used to "turn the line around" in half duplex modems, and
  1402.   for hardware flow control in most modems that require flow control.  CTS  is
  1403.   controlled by the serial device (modem) and read by the computer.
  1404.  
  1405.   Data Carrier Detect Pin 8 (DB25), Pin 1 (DB9)
  1406.  
  1407.   The DCD line is used by the modem to signal the computer that a data carrier
  1408.   signal is present.
  1409.  
  1410.   Ring Indicator Pin 22 (DB25), Pin 9 (DB9)
  1411.  
  1412.   The RI line is asserted when a 'ring' occurs.
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  PCL4W Users Manual                                                Page 21
  1429.   6.7 National INS8250, INS16450, and INS16550 UARTs
  1430.  
  1431.  
  1432.   The  Personal  Communications  Library  is  based  on  the standard National
  1433.   INS8250, INS16450, and INS16550 UARTs. The 8250 was the original  UART  used
  1434.   in  the IBM PC, whereas the 16450 is a faster version found on most 286 & up
  1435.   machines. The 16550 contains a 16 byte FIFO to further reduce communications
  1436.   overhead. These UARTs consists of 8 register ports as follows:
  1437.  
  1438.   Offset R/W Register
  1439.      0   R/W    Receiver  (read)  /  Transmitter  (write)
  1440.      1   R/W    Interrupt Enable (read)
  1441.      2   R      Interrupt Identification
  1442.      2   W      FIFO control (INS16550 only)
  1443.      3   R/W    Data Format (Line Control)
  1444.      4   R/W    RS-232 (Modem) Control
  1445.      5   R/W    Line Status
  1446.      6   R/W    RS-232 (Modem) Status
  1447.      7   R/W    Not used.
  1448.  
  1449.   For  the  standard  PC  ports  (not DigiBoard ports), the UART registers are
  1450.   based at 3F8h (COM1), 2F8h (COM2), 3E8h (COM3), and 2E8h (COM4).   COM1  and
  1451.   COM3  share  interrupt  request  line IRQ4 while COM2 and COM4 share request
  1452.   line IRQ3.  This means that  COM1  and  COM3  can't  be  used  concurrently.
  1453.   Similarly for COM2 and COM4.
  1454.  
  1455.   However,  standard PC ports may be re-configured to use other UART addresses
  1456.   and IRQ assignments.  Refer  to  the  SioPorts(),  SioUART(),  and  SioIRQ()
  1457.   functions.
  1458.  
  1459.   If  you  have  a  DigiBoard PC/4 (or PC/8) installed, you will have 4 (or 8)
  1460.   additional ports using INS16450 or INS16550 UARTS.   The  default  DigiBoard
  1461.   ports  are  located  at 100h, 108h, 110h & 118h for the PC/4 continuing with
  1462.   120h 128h, 130h & 138h for the PC/8. IRQ3 is the default for all ports.
  1463.  
  1464.   Four sources of interrupts  are  possible  with  the  8250  and  16550:  (1)
  1465.   receiver error or BREAK, (2) receiver data ready, (3) ready to transmit, and
  1466.   (4)  RS232  input.   These  four  sources  of  interrupts  are summarized as
  1467.   follows:
  1468.  
  1469.        Source of Interrupt        Action Required to Clear
  1470.        Receiver error or BREAK.   Read Line Status register.
  1471.        Receiver data.             Read data from data register.
  1472.        Transmitter Buffer Empty.  Write to data register or read IID reg.
  1473.        RS232 Input.               Read Modem Status register.
  1474.  
  1475.   If  you are not familiar with UARTS, several good books are available. Refer
  1476.   to  Chapter  6.0,  Serial  Communications   chapter   for   recommendations.
  1477.   Although  a knowledge of the 8250/16450/16550 is not necessary to use PCL4W,
  1478.   a general knowledge of the theory of asynchronous serial  communications  is
  1479.   helpful.
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  PCL4W Users Manual                                                Page 22
  1497.   6.8 Register Summary
  1498.  
  1499.  
  1500.   REG 0 : Data Register
  1501.  
  1502.   Reading from the data register fetches the  next  input  byte,  once  it  is
  1503.   ready.   Writing  to the data register transmits the byte written to it over
  1504.   the serial line.
  1505.  
  1506.   REG 1 : Interrupt Enable
  1507.  
  1508.   The Interrupt Enable register enables each of four types of interrupts  when
  1509.   the appropriate bit is set to a one.
  1510.  
  1511.        bit 3 :  Enable interrupt  on  RS232  input.
  1512.        bit 2 :  Enable interrupt on receiver error or break.
  1513.        bit 1 :  Enable interrupt on transmitter buffer empty (TBE).
  1514.        bit 0 :  Enable interrupt on received data (RxRDY).
  1515.  
  1516.   REG 2 : Interrupt Identification (IID)
  1517.  
  1518.   Reading the Interrupt Identification (read only) register once an  interrupt
  1519.   has occurred identifies the interrupt as follows:
  1520.  
  1521.        Bit 2  Bit 1  Bit 0  Priority   Interrupt
  1522.          0     0      1      none      none
  1523.          1     1      0      0         (high) Serialization or break.
  1524.          1     0      0      1         Received data.
  1525.          0     1      0      2         Transmitter Buffer Empty.
  1526.          0     0      0      3         (low) RS232 Input.
  1527.  
  1528.   In  the  INS16650,  REG  2  (write  only) is also the FIFO control register.
  1529.   Writing bits 6 & 7 will set the FIFO trigger level (number of bytes received
  1530.   before an interrupt is generated).
  1531.  
  1532.         Bit 7  Bit 6   Trigger             Bit 7  Bit 6   Trigger
  1533.           0      0      1 byte               1      0     8 bytes
  1534.           0      1      4 bytes              1      1     14 bytes
  1535.  
  1536.   REG 3 : Line Control
  1537.  
  1538.   RS232 line parameters are selected by writing to this register.
  1539.  
  1540.        bit 7   : DLAB = 0
  1541.        bit 6   : BREAK on(1), off(0).
  1542.        bits 5-3: Parity None(000),ODD(001),EVEN(011),MARK(101),SPACE(111)
  1543.        bit 2   : One stop bit(0), two stop bits(1).
  1544.        bits 1-0: Data bits = 5 (00), 6(01), 7(10), 8(11).
  1545.  
  1546.   When  the Divisor Latch Access Bit (DLAB) is 1, registers 0 and 1 become the
  1547.   LS and MS bytes of the Baud Rate Divisor registers.
  1548.  
  1549.        Baud   Divisor      Baud  Divisor      Baud  Divisor
  1550.         300    0180        4800   0018       38400   0003
  1551.        1200    0060        9600   000C       57600   0002
  1552.        2400    0030       19200   0006      115200   0001
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  PCL4W Users Manual                                                Page 23
  1565.   REG 4 : Modem Control
  1566.  
  1567.   RTS, DTR, loopback testing, and  General  Purpose  Outputs  #1  and  #2  are
  1568.   controlled by the Modem Control register as follows:
  1569.  
  1570.        bit 4 : Enable local loopback.
  1571.        bit 3 : Enable GP02. Necessary for 8250 interrupts.
  1572.        bit 2 : Enable GP01.
  1573.        bit 1 : Set / clear RTS.
  1574.        bit 0 : Set / clear DTR.
  1575.  
  1576.   REG 5 : Line Status
  1577.  
  1578.   Reading  the  Line Status register provides status information as follows (1
  1579.   for TRUE, 0 for FALSE) :
  1580.  
  1581.        bit 6 : Transmitter Empty.
  1582.        bit 5 : Transmitter Buffer Empty (TBE).
  1583.        bit 4 : BREAK detect.
  1584.        bit 3 : Framing error.
  1585.        bit 2 : Parity error.
  1586.        bit 1 : Overrun error.
  1587.        bit 0 : Data Ready.
  1588.  
  1589.   REG 6 : Modem Status
  1590.  
  1591.   Reading the Modem Status register provides the following status  information
  1592.   (1 for TRUE, 0 for FALSE) :
  1593.  
  1594.        bit 7 : DCD status.
  1595.        bit 6 : RI status.
  1596.        bit 5 : DSR status.
  1597.        bit 4 : CTS status.
  1598.        bit 3 : Delta DCD status.
  1599.        bit 2 : Delta RI status.
  1600.        bit 1 : Delta DSR status.
  1601.        bit 0 : Delta CTS status.
  1602.  
  1603.   The delta bits (bits 0 through 3) are set whenever one of  the  status  bits
  1604.   (bits  4 through 7) changes (from 0 to 1 or from 1 to 0) since the last time
  1605.   the Modem Status register was read. Reading the Modem Status register clears
  1606.   the delta bits.
  1607.  
  1608.   REG 7 : Scratch Register
  1609.  
  1610.   There  is  no  function  associated  with  register 7.  It does not exist in
  1611.   earlier versions of the 8250.
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  PCL4W Users Manual                                                Page 24
  1633.   7.0 Example Programs
  1634.  
  1635.  
  1636.   There  are  two  example  programs  provided  as described below. A separate
  1637.   directory should be  created  for  each  (and  every)  example  program.  In
  1638.   particular,  the  two example programs described below should be in separate
  1639.   directories.
  1640.  
  1641.   It is recommended that SIMPLE be compiled, linked, and run as a test of  the
  1642.   software installation.
  1643.  
  1644.   In  an  attempt  to  minimize the size of the shareware version of the PCL4W
  1645.   library,  the  TERM  program  files  are  distributed  as  a  separate  file
  1646.   (WTERMxx.ZIP,  where  xx  is the current version). WTERMxx.ZIP can always be
  1647.   downloaded from the MarshallSoft support BBS.
  1648.  
  1649.  
  1650.   7.1 SIMPLE.C
  1651.  
  1652.  
  1653.   SIMPLE is meant as a very  straight  forward,  easy  to  understand  windows
  1654.   communications  program.   Unfortunately,  windows programs are not all that
  1655.   straight forward or easy to understand.
  1656.  
  1657.   SIMPLE is a simple terminal emulator. It reads  from  the  serial  port  and
  1658.   writes  to  the  client  area  and reads from the keyboard and writes to the
  1659.   serial port.  SIMPLE can also talk to a modem, although  you  will  have  to
  1660.   command the modem directly.
  1661.  
  1662.   The  best  way  to  test SIMPLE is to run it on two machines conmnected by a
  1663.   null modem cable. Whatever is typed on one is displayed on  the  other,  and
  1664.   vice  versa.   If you have but one computer, you can use SIMPLE to talk to a
  1665.   modem.
  1666.  
  1667.   To make SIMPLE using the Microsoft SDK, type:
  1668.  
  1669.        NMAKE SIMPLE._M_
  1670.  
  1671.   To make simple using the Borland compiler, type:
  1672.  
  1673.        MAKER -fSIMPLE._B_
  1674.  
  1675.   If  you  use a graphical development environment, put the following files in
  1676.   your project file:
  1677.  
  1678.   SIMPLE SIOERROR SIMPL_IO EXPECT CONFIG PAINT LINE ABOUT PCL4W.LIB
  1679.  
  1680.   If  you  are  using  the  Borland  IDE,  be  sure  and  turn off LINKER case
  1681.   sensitivies: From the IDE, choose OPTIONS,  PROJECTS,  LINKER,  GENERAL  and
  1682.   turn  off  the  "case sensitive link" and "case sensitive exports & imports"
  1683.   boxes.
  1684.  
  1685.   The SIMPLE makefiles use the small memory model. If a different memory model
  1686.   is  required,  the  Microsoft  (or  Borland)  runtime  library  must also be
  1687.   changed to match the memory model. No  change  is  required  for  the  PCL4W
  1688.   library.
  1689.  
  1690.   For example, to change the makefile from using the  small  memory  model  to
  1691.   using  the  medium  memory  model,  the following changes are necessary: For
  1692.   Microsoft, change -AS to -AM and change SLIBCEW to  MLIBCEW.   For  Borland,
  1693.   change -sm to -mm and change C0WS, CWS, and MATHWS to C0WM, CWM, and MATHWM.
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  PCL4W Users Manual                                                Page 25
  1701.   7.2 TERM.C
  1702.  
  1703.  
  1704.   TERM is an  communications  program  suitable  for  calling  bulletin  board
  1705.   systems  (BBS)  and performing as a PC to PC file copy program.  TERM itself
  1706.   is not part of the communications library, but rather it is provided  as  an
  1707.   example of a communications application using PCL4W.
  1708.  
  1709.   TERM can send a standard Hayes standard AT command set string to your modem.
  1710.   An  initialization  string  is  sent  by  TERM  provided  that  the constant
  1711.   AT_COMMAND_SET in the file TERM.CFG is defined to be TRUE:
  1712.  
  1713.        #define AT_COMMAND_SET 1
  1714.  
  1715.   Refer   to   Section   4.4,  "Modem  Initialization"  for  a  discussion  of
  1716.   initialization strings.
  1717.  
  1718.   TERM also supports hardware flow control (RTS/CTS). Hardware flow control is
  1719.   observed  provided that the constant RTS_CTS_CONTROL in the file TERM.CFG is
  1720.   defined to be TRUE:
  1721.  
  1722.        #define RTS_CTS_CONTROL 1
  1723.  
  1724.   Refer to Section 4.2, "Flow Control"  for  a  discussion  of  hardware  flow
  1725.   control.
  1726.  
  1727.   TERM  can  also  exchange  files using ASCII (with XON/XOFF), XMODEM, YMODEM
  1728.   (batch  capability),  and  YMODEM-G  (streaming  YMODEM  used   with   error
  1729.   correcting  modems)  communications protocols.  TERM can accept wildcards in
  1730.   the filename so that multiple files can be sent using YMODEM  and  YMODEM-G.
  1731.   The  protocol  timing can also be adjusted (this should not be necessary) by
  1732.   modifying the constants SHORT_WAIT and LONG_WAIT in the TERM.CFG file.
  1733.  
  1734.   TERM  can  be  configured  to  run  script  files  (the  script  compiler  /
  1735.   interpreter is part of the registration package only) by setting
  1736.  
  1737.       #define SCRIPTS 1
  1738.  
  1739.   in TERM.H. Registered users can refer to SCRIPTS.DOC information on SCRIPTS.
  1740.  
  1741.   TERM can also be used as a PC to PC transfer  program  using  a  null  modem
  1742.   cable. In this case, AT_COMMAND_SET and RTS_CTS_CONTROL should be defined to
  1743.   be FALSE in the file TERM.CFG:
  1744.  
  1745.        #define AT_COMMAND_SET  0
  1746.        #define RTS_CTS_CONTROL 0
  1747.  
  1748.   Be advised that many null modem cables do NOT swap RTS  and  CTS,  which  is
  1749.   necessary  for hardware flow control. This means that RTS_CTS_CONTROL should
  1750.   never be set to 1 (TRUE) when using  a  null  modem  cable  unless  you  are
  1751.   absolutely sure that RTS and CTS are swapped.
  1752.  
  1753.   The  TERM  program  (but  of course not the library itself) is placed in the
  1754.   public domain by MarshallSoft Computing, Inc., and can be used  in  any  way
  1755.   desired by the user.
  1756.  
  1757.   To make TERM using the Microsoft SDK, type:
  1758.  
  1759.        NMAKE TERM._M_
  1760.  
  1761.   To make simple using the Borland compiler, type:
  1762.  
  1763.        MAKER -fTERM._B_
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  PCL4W Users Manual                                                Page 26
  1769.   8.0 Legal Issues
  1770.  
  1771.   8.1 Registration
  1772.  
  1773.  
  1774.   If you wish to register the PCL4W library, please send $65 plus $5 S&H  ($10
  1775.   outside of North America) to:
  1776.  
  1777.        MarshallSoft Computing, Inc.
  1778.        Post Office Box  4543
  1779.        Huntsville AL 35815-4543
  1780.  
  1781.   Multiple  copies  are available: $50 each for 3 to 9, $40 each for 10 to 19,
  1782.   and $30 each for 20 or more.  A site license  is  also  available  for  $550
  1783.   (includes 5 sets of printed documentation). We pay shipping.
  1784.  
  1785.   We accept American Express, VISA, MasterCard, checks in US dollars drawn  on
  1786.   a  US  bank,  purchase orders (POs) from recognized US schools and companies
  1787.   listed in Dun &  Bradstreet,  and  COD  (street  address  and  phone  number
  1788.   required)  within  the USA (plus a $5 COD charge).
  1789.  
  1790.   For  credit  card  orders,  be  sure  to  include  the  account  number, the
  1791.   expiration date, the exact name on the card, and the complete  card  billing
  1792.   address (the address to which the credit card bill is mailed).
  1793.  
  1794.   You can also order PCL4W from The Public Software Library  (PSL)  with  your
  1795.   MC,  Visa,  AmEx,  or  Discover card by calling 800-242-4PSL (from overseas:
  1796.   713-524-6394) or by FAX at 713-524-6398 or  by  CompuServe  at  [71355,470].
  1797.   THESE NUMBERS ARE FOR ORDERING ONLY. The product number for PCL4W is 11171.
  1798.  
  1799.   Print the file PCL4W.INV if an invoice is needed.
  1800.  
  1801.   If you wish to update from an older version of PCL4W, send $20 plus  $5  S&H
  1802.   ($10  outside  of  North  America).   Updates  must be ordered directly from
  1803.   MarshallSoft Computing.
  1804.  
  1805.   The registered package includes:
  1806.  
  1807.        o  PCL4W Library w/o shareware screens.
  1808.        o  Assembler source code for the library.
  1809.        o  SCRIPT language V2.1 (compiler and interpreter).
  1810.        o  Laser printed Users and Reference Manuals.
  1811.        o  Telephone, BBS, and email support for one year.
  1812.  
  1813.   The  registered user will receive the latest version of PCL4W shipped by two
  1814.   day priority mail (packet airmail overseas).  A 3.5"  diskette  is  provided
  1815.   unless a 5.25" diskette is requested.
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  PCL4W Users Manual                                                Page 27
  1837.   8.2 License
  1838.  
  1839.  
  1840.   MarshallSoft  Computing,  Inc. grants the registered user of PCL4W the right
  1841.   to use one copy of the PCL4W library (in object form) on a  single  computer
  1842.   in  the  development  of  any software product (other than libraries such as
  1843.   PCL4W).  The user may not use the library on more than one computer  at  the
  1844.   same  time.   The  source code for the library (PCL4W.ASM) is copyrighted by
  1845.   MarshallSoft Computing and may not be released in whole or in part. Products
  1846.   developed using PCL4W may be distributed without any royalty.
  1847.  
  1848.  
  1849.   8.3 Warranty
  1850.  
  1851.  
  1852.   MARSHALLSOFT COMPUTING, INC.  DISCLAIMS  ALL  WARRANTIES  RELATING  TO  THIS
  1853.   SOFTWARE,  WHETHER  EXPRESSED  OR  IMPLIED, INCLUDING BUT NOT LIMITED TO ANY
  1854.   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR  PURPOSE,
  1855.   AND  ALL  SUCH WARRANTIES ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. NEITHER
  1856.   MARSHALLSOFT COMPUTING, INC. NOR ANYONE ELSE WHO HAS BEEN  INVOLVED  IN  THE
  1857.   CREATION,  PRODUCTION,  OR DELIVERY OF THIS SOFTWARE SHALL BE LIABLE FOR ANY
  1858.   INDIRECT, CONSEQUENTIAL, OR INCIDENTAL DAMAGES ARISING OUT  OF  THE  USE  OR
  1859.   INABILITY  TO  USE  SUCH  SOFTWARE EVEN IF MARSHALLSOFT COMPUTING, INC.  HAS
  1860.   BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR CLAIMS. IN NO EVENT SHALL
  1861.   MARSHALLSOFT COMPUTING, INC.'S LIABILITY FOR ANY SUCH  DAMAGES  EVER  EXCEED
  1862.   THE  PRICE  PAID FOR THE LICENSE TO USE THE SOFTWARE, REGARDLESS OF THE FORM
  1863.   OF THE CLAIM. THE PERSON USING THE SOFTWARE BEARS ALL RISK AS TO THE QUALITY
  1864.   AND PERFORMANCE OF THE SOFTWARE.
  1865.  
  1866.   Some states do not allow  the  exclusion  of  the  limit  of  liability  for
  1867.   consequential  or  incidental damages, so the above limitation may not apply
  1868.   to you.
  1869.  
  1870.   This agreement shall be governed by the laws of the  State  of  Alabama  and
  1871.   shall  inure  to  the  benefit  of  Marshallsoft  Computing,  Inc.   and any
  1872.   successors, administrators, heirs and  assigns.  Any  action  or  proceeding
  1873.   brought  by either party against the other arising out of or related to this
  1874.   agreement shall be brought only in a STATE or  FEDERAL  COURT  of  competent
  1875.   jurisdiction  located in Madison County, Alabama. The parties hereby consent
  1876.   to in personam jurisdiction of said courts.
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  PCL4W Users Manual                                                Page 28
  1905.   9.0 Summary
  1906.  
  1907.  
  1908.   9.1 Revision History
  1909.  
  1910.  
  1911.   Version 1.0: 1 February, 1994.
  1912.  
  1913.  
  1914.   The  initial  release  of  PCL4W uses a considerable amount of the code from
  1915.   version 4.0 of PCL4C (the DOS version of the comm library).
  1916.  
  1917.  
  1918.   Version 1.1:  August 1, 1994
  1919.  
  1920.  
  1921.   o A flow control bug was fixed.
  1922.   o COM11 through COM16 defined.
  1923.   o Supports the BB1004, BB1008, and BB2016 BOCA boards.
  1924.   o The new function SioGetDiv() was added.
  1925.   o A script compiler & interpreter was added to the registration package.
  1926.  
  1927.  
  1928.   Version 1.2:  August 8, 1995
  1929.  
  1930.  
  1931.   o Defined ports extended to 20.
  1932.   o Support for all IRQs [IRQ0 to IRQ15].
  1933.   o Bug in BREAK detection corrected.
  1934.   o Bug in SioRxFlush fixed.
  1935.   o SioInfo also returns # interrupts.
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  PCL4W Users Manual                                                Page 29
  1973.   9.2 Function Summary
  1974.  
  1975.   Refer  to the PCL4W Reference Manual (PCL4W.REF) for detailed information on
  1976.   the communications and  support  functions.  A  one  line  summary  of  each
  1977.   function follows:
  1978.  
  1979.   +--------------+-----------------------------------------------------------+
  1980.   |  SioBaud     |  Sets the baud rate of the selected port.                 |
  1981.   |  SioBrkSig   |  Asserts, cancels, or detects BREAK signal.               |
  1982.   |  SioCTS      |  Reads the Clear to Send (CTS) modem status bit.          |
  1983.   |  SioDCD      |  Reads the Data Carrier Detect (DCD) modem status bit.    |
  1984.   |  SioDone     |  Terminates further serial processing.                    |
  1985.   |  SioDSR      |  Reads the Data Set Ready (DSR) modem status bit.         |
  1986.   |  SioDTR      |  Set, clear, or read the Data Terminal Ready (DTR) bit.   |
  1987.   |  SioError    |  Displays error in text.                                  |
  1988.   |  SioFIFO     |  Sets the interrupt level for the INS16550.               |
  1989.   |  SioFlow     |  Enables / disables hardware flow control.                |
  1990.   |  SioGetc     |  Reads the next character from the serial line.           |
  1991.   |  SioGetDiv   |  Gets the baud rate divisor.                              |
  1992.   |  SioInfo     |  Returns library ver number, memory model, # interrupts   |
  1993.   |  SioIRQ      |  Assigns an IRQ line to a port.                           |
  1994.   |  SioLine     |  Reads the line status register.                          |
  1995.   |  SioLoopBack |  Performs a UART loopback test.                           |
  1996.   |  SioModem    |  Reads the modem status register.                         |
  1997.   |  SioParms    |  Sets parity, stop bits, and word length.                 |
  1998.   |  SioPorts    |  Sets # ports, 1st DigiBoard port & status register.      |
  1999.   |  SioPutc     |  Transmit a character over a serial line.                 |
  2000.   |  SioRead     |  Reads any of 7 UART ports.                               |
  2001.   |  SioReset    |  Initialize a serial port for processing.                 |
  2002.   |  SioRI       |  Reads the Ring Indicator (RI) modem status bit.          |
  2003.   |  SioRTS      |  Sets, clears, or reads the Request to Send (RTS) line.   |
  2004.   |  SioRxBuf    |  Sets up receive buffer.                                  |
  2005.   |  SioRxFlush  |  Flushes (clears) the receive buffer.                     |
  2006.   |  SioRxQue    |  Returns the number of characters in the receive queue.   |
  2007.   |  SioTxBuf    |  Sets up transmit buffer.                                 |
  2008.   |  SioTxFlush  |  Flushes (clears) the transmit buffer.                    |
  2009.   |  SioTxQue    |  Returns the number of characters in the transmit queue.  |
  2010.   |  SioUART     |  Sets the UART base address.                              |
  2011.   |  SioUnGetc   |  "Un-gets" (puts back) a specified character.             |
  2012.   +--------------+-----------------------------------------------------------+
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  PCL4W Users Manual                                                Page 30
  2041.   9.3 Further Reading
  2042.  
  2043.  
  2044.   The  best way to learn about serial communications is to read a good book on
  2045.   the subject. Several good texts are available.  Two that I like are:
  2046.  
  2047.   (1) C Programmers's Guide to Serial Communications by  Joe  Campbell  (SAMS)
  2048.   (2) Mastering Serial Communications by Peter Gofton (SYBEX).
  2049.  
  2050.  
  2051.   10.0 Other MarshallSoft Computing Products
  2052.  
  2053.  
  2054.   The following shareware  libraries  are  also  available  from  MarshallSoft
  2055.   Computing.   They  can  be  registered  directly  through us.
  2056.  
  2057.   10.1 The Personal Communications Library for C/C++
  2058.  
  2059.   The Personal Communications Library for the C  Language  (PCL4C)  is  a  DOS
  2060.   based  asynchronous communications library designed for experienced software
  2061.   developers programming  in  C.   Four  compilers  are  supported:  Microsoft
  2062.   Optimizing  C,  Microsoft Quick C, Borland Turbo C, and MIX Power C.  An IBM
  2063.   PC/XT/AT or compatible is required.  PCL4C is the DOS equivalent of PCL4W.
  2064.  
  2065.   The Personal Communications Library for C (PCL4C) is available for $65  plus
  2066.   $5  S&H  ($10 S&H overseas). PCL4C and PCL4W can be ordered together for $95
  2067.   plus $5 S&H ($10 overseas).
  2068.  
  2069.   10.2 Libraries for Other Languages
  2070.  
  2071.   We also have communication libraries for Turbo Pascal, Visual  Basic  (DOS),
  2072.   and  PowerBASIC.  A Visual BASIC library for Windows will be released in the
  2073.   fall of 1995.
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  PCL4W Users Manual                                                Page 31
  2109.